// 用户模块
// import { findBanner } from '@/api/home.js'
// import Message from '@/components/library/Message'
export default {
  namespaced: true,
  state () {
    return {
      suggestList: [],
      active: '1',
      fileList: [],
      fileList2: [],
      fileList3: [],
      fileList4: [],
      fileList5: [],
      fileList6: []
    }
  },
  mutations: {
    // 获取推荐的数据
    SETSUGGEST (state, data) {
      state.suggestList = data
    },
    SETACTIVE (state, data) {
      state.active = data
    },
    SETFILELIST (state, data) {
      state.fileList.push({ url: data })
    },
    SETFILELIST2 (state, data) {
      state.fileList2.push({ url: data })
    },
    SETFILELIST3 (state, data) {
      state.fileList3.push({ url: data })
    },
    SETFILELIST4 (state, data) {
      state.fileList4.push({ url: data })
    },
    SETFILELIST5 (state, data) {
      state.fileList5.push({ url: data })
    },
    SETFILELIST6 (state, data) {
      state.fileList6.push({ url: data })
    },
    SETDELETEFILELIST (state, data) {
      for (let i = 0; i < state.fileList.length; i++) {
        if (state.fileList[i].url === data) {
          state.fileList.splice(i, 1)
        }
      }
    },
    SETDELETEFILELIST2 (state, data) {
      for (let i = 0; i < state.fileList2.length; i++) {
        if (state.fileList2[i].url === data) {
          state.fileList2.splice(i, 1)
        }
      }
    },
    SETDELETEFILELIST3 (state, data) {
      for (let i = 0; i < state.fileList3.length; i++) {
        if (state.fileList3[i].url === data) {
          state.fileList3.splice(i, 1)
        }
      }
    },
    SETDELETEFILELIST4 (state, data) {
      for (let i = 0; i < state.fileList4.length; i++) {
        if (state.fileList4[i].url === data) {
          state.fileList4.splice(i, 1)
        }
      }
    },
    SETDELETEFILELIST5 (state, data) {
      for (let i = 0; i < state.fileList5.length; i++) {
        if (state.fileList5[i].url === data) {
          state.fileList5.splice(i, 1)
        }
      }
    },
    SETDELETEFILELIST6 (state, data) {
      for (let i = 0; i < state.fileList6.length; i++) {
        if (state.fileList6[i].url === data) {
          state.fileList6.splice(i, 1)
        }
      }
    }
  },
  actions: {
    // 获取推荐的数据
    async setSuggest (ctx) {
      // const res = await findBanner()
      // if (res.code === '999') {
      //   Message({ type: 'error', text: res.msg })
      // }
      // // console.log(res)
      // const data = res.data[1].suggestList || []
      // ctx.commit('SETSUGGEST', data)
    },
    setActive (ctx, data) {
      ctx.commit('SETACTIVE', data)
    }
  }
}
